local FightBuff = require("gameLogic.fight.fightBuff.FightBuff")
local BuffOptAttr = class("BuffOptAttr", FightBuff)
local AttributeConst = require("const.AttributeConst")
local Hurt = require("gameLogic.fight.fightHurtStrategy.Hurt")

function BuffOptAttr:ctor(config, entity, whoEntity)
    BuffOptAttr.super.ctor(self, config, entity, whoEntity)
end

function BuffOptAttr:_excute(battleReport)
    local attack_attr = self._config.attack_attr
    local dtValue = self:_attrChange()
    local curAttrValue = self._entity:getBaseAttrValue(attack_attr)
    if self._config.toneup == 0 then
        curAttrValue = curAttrValue - dtValue
    else
        curAttrValue = curAttrValue + dtValue
    end
    if attack_attr == AttributeConst.BLOOD then
        local hurt = nil
        if self._config.toneup == 0 then
            hurt = Hurt.new(dtValue, false, self._element)
        else
            hurt = Hurt.new(dtValue, false, AttributeConst.ELEMENT_TREATMENT)
        end
        self._entity:simpleHurt(hurt, battleReport)
        battleReport:addSubHurt(hurt, self._entity, self._entity)
    else
        self._entity:optAttrValue(attack_attr, curAttrValue)
        self._manager:afectBuffReport(self, dtValue, battleReport)
    end
end

function BuffOptAttr:resetbuff()
end

return BuffOptAttr
